package com.leyou.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//@EnableConfigurationProperties(SmsProperties.class)
public class SmsConfiguration {

    /**
     * @param prop 配置对象
     * @return 发送短信的客户端
     */
    @Bean
    public IAcsClient iAcsClient(SmsProperties prop) {
        DefaultProfile profile = DefaultProfile
                .getProfile(prop.getRegionID(),
                        prop.getAccessKeyID(), prop.getAccessKeySecret());
        IAcsClient client = new DefaultAcsClient(profile);
        return client;
    }

}
